<template>
  <div class="allencat">
    <el-button class="cheaback" type="text" icon="el-icon-back" @click="hback"
      >返回</el-button
    >

    <el-tabs>
      <h4>提现信息</h4>
      <el-form label-width="100px" :model="formLabelAlign">
        <el-form-item label="活动名称" prop="goods">
          <el-input :disabled="true" v-model="goods"></el-input>
        </el-form-item>
        <el-form-item label="用户名">
          <el-input :disabled="true" v-model="formLabelAlign.accountType"></el-input>
        </el-form-item>
        <el-form-item label="真实姓名">
          <el-input :disabled="true" v-model="formLabelAlign.realName"></el-input>
        </el-form-item>
        <el-form-item label="提现金额">
          <el-input :disabled="true" v-model="formLabelAlign.amount"></el-input>
        </el-form-item>
        <el-form-item label="银行卡号">
          <el-input :disabled="true" v-model="formLabelAlign.account"></el-input>
        </el-form-item>
        <el-form-item label="所属银行">
          <el-input :disabled="true" v-model="formLabelAlign.bankName"></el-input>
        </el-form-item>
        <el-form-item label="身份证号码">
          <el-input :disabled="true" autosize v-model="formLabelAlign.idCardNumber"></el-input>
        </el-form-item>
        <el-form-item label="预留手机号">
          <el-input :disabled="true" autosize v-model="formLabelAlign.phone"></el-input>
        </el-form-item>
        <el-form-item label="审核状态">
          <el-input :disabled="true" autosize v-model="this.sg"></el-input>
        </el-form-item>
        <el-form-item label="提交时间">
          <el-input :disabled="true" v-model="formLabelAlign.applyTime"></el-input>
        </el-form-item>
        <el-form-item class="hbox">
          <template v-if="this.formLabelAlign.status == 'WaitAudit'" >       
          <el-button class="defaulte" @click="hsubmet()">同意提现</el-button>
          <el-button class="default" @click="reexamination()"
            >驳回</el-button
          >
          </template>

                <template v-else >
          <el-button class="defaulte" disabled @click="hsubmet()">同意提现</el-button>
          <el-button class="default" disabled @click="reexamination()"
            >驳回</el-button
          >
          </template>
        </el-form-item>
      </el-form>

    </el-tabs>
  </div>
</template>

<script>
import {userconsent,userassignment} from '@/api/roles'
import sce from './farg.js'
export default {
  data() {
    return {
      sg:'',
      textarea: "",
      dialogFormVisible: false,
      list:[],
      formLabelAlign: {
        realName: "",
        accountType: "",
        amount: "",
        account:'',
        bankName:'',
        idCardNumber:'',
        phone:'',
        status:'',
        applyTime:'',
        remake:'',
      },
        goods:'邀新人 赚福利',
      form: {
        name: "",
      },
    };
  },
  created(){
   this.loachenget()
  },
  methods: {
    // 数据回填
    loachenget(){
       this.formLabelAlign = this.$route.query.row;
        // console.log(this.formLabelAlign);
      this.list = this.formLabelAlign;
         this.sg=sce(this.formLabelAlign.status)
    },
    // 同意
     hsubmet() {
       this.$confirm("您确认要提现么?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(async () => {
          const params = new URLSearchParams(); // 创建URLSearchParams数据对象
          params.append("withdrawId", this.list.withDrawId); //
          const res = await userconsent(params);
          this.loachenget();
          if (res.code !== 200) return  this.$message.error(res.msg);
            this.$router.push('deposit/withdraw')
          this.$message.success(res.msg);
        })
        .catch(() => {});
    },
    // 拒绝
    reexamination(){
        this.$prompt("请输入拒绝理由", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
      })
        .then(async ({ value }) => {
          const param = new URLSearchParams();
          param.append("remake", this.list.remake + value);
          param.append("withdrawId", this.list.withDrawId);

          const res = await userassignment(param);
          this.loachenget();
          if (res.code !== 200) return this.$message.error(res.msg);
            this.$router.push('deposit/withdraw')
          this.$message.success(res.msg);
        })
        .catch(() => {
          this.$message({ type: "info", message: "取消输入" });
        });
    },
    // 返回
    hback() {
      this.$router.back();
    },
  },
};
</script>

<style scoped>
.allencat {
  background-color: #fff;
  height: 100%;
}
.el-tabs{
  background-color: #fff;
}
.el-textarea,
.el-input {
  width: 300px;
}
.el-form-item__label {
  margin-left: 500px;
  margin-right: 0;
}
.el-form-item {
  transform: translateX(33%);
}
h4 {
  height: 30px;
  line-height: 30px !important;
  text-align: center;
}
.el-image {
  margin-right: 20px;

  transform: translateX(390%);
}
.hbox {
  text-align: center;
  transform: translateX(-5%);
  margin-top: 20px;
}
.ctehon {
  transform: translateX(5%);
}
.el-dialog__title {
  text-align: center !important;
}
.el-input__count {
  transform: translateY(-24px);
}
.el-button--primary {
  background-color: #ff7144;
}

.defaulte {
  border: 1px solid #ff7144;

  background-color: #ff7144;
  color: #fff;
  margin-bottom: 100px;
}
.defaulte:hover{
  border: 1px solid #ff7144;
  background-color: #ff7144;
  color: #fff;
  margin-bottom: 100px;

}
.el-image-viewer__img {
  max-height: 45%;
}
</style>
